package com.hzy.admin.controller.system;

import com.hzy.admin.controller.ApiBaseController;
import com.hzy.admin.models.vo.system.UpdatePasswordVo;
import com.hzy.admin.services.system.ISysUserService;
import com.hzy.framework.ApiResult;
import com.hzy.framework.annotation.SystemAuthority;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 修改密码
 *
 * @author hzy
 */
@Controller
@RequestMapping("/admin/change/password")
public class ChangePasswordController extends ApiBaseController<ISysUserService> {
    public ChangePasswordController(ISysUserService service) {
        super("f35d64ae-ecb7-4d06-acfb-d91595966d9e", service, "/system/changepassword/");
    }

    /**
     * 列表页面
     *
     * @return 页面
     */
    @SystemAuthority()
    @GetMapping("/index")
    public String index() {
        return this.view("index");
    }

    /**
     * 修改密码
     * @param vo
     * @return
     */
    @PostMapping("/save")
    @ResponseBody
    public ApiResult changePassword(@RequestBody UpdatePasswordVo vo) {
        this.service.changePassword(vo);
        return this.resultOk();
    }

}
